home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr25
/
tmbnk201.zip
/
TIMEBANK.CMD
< prev
Wrap
OS/2 REXX Batch file
|
1993-03-03
|
9KB
|
244 lines
/* TimeBank Version 2.01
Rexx CMD file for a Time Bank for Maximus
by Edward Owens
of The Looking Glass
FidoNet 1:123/81
To run put the following line in your MENU.CTL file where you want it:
ReRead Xtern_Run Maxpipe_%P_TimeBank.cmd_%K Normal "TimeBank"
Then replace the bbs and sysop variables immediately below and put
this CMD file in your Maximus directory. You may modify this in any way
your little heart's desires but do not distribute once modified. This is a rough
first chop there will be another version to follow with more features. This
is Freeware, there is no charge for it and I assume no responsibility for any
damage it may do. Have fun.*/
echo off
/* ansi on */
bbs="The Looking Glass" /* Replace with the name of your bbs */
sysop="Fast ED's" /* Replace with your name or handle */
maxtime=120 /* Maximum amount of time on account */
deptime=30 /* Maximum time deposit per day */
withtime=30 /* Maximum time withdrawal per day */
maxbytes=3000 /* Maximum Kbytes on account */
depbytes=300 /* Maximum Kbytes deposit per day */
withbytes=300 /* Maximum Kbytes withdrawal per day */
timeint=10 /* Interest rate per 30 days on time accounts */
byteint=10 /* Interest rate per 30 days on byte accounts */
/* userfile='lastuser.bbs' */
userfile=INSERT(arg(1),'lastus.bbs',6) /* Replace with above line if single node */
CLS
say
say
say '
********************************'
say '
*
Welcome to TimeBank
*'
say '
*
by Edward Owens
*'
say '
*
FidoNet 1:123/81
*'
say '
*
Written in REXX for OS/2
*'
say '
********************************'
say '1H'
say '
Reading account information.......'
bankfile='timebank.dat'
usedbytes=0
privbytes=0
position=1
name=STRIP(CHARIN(userfile,1,36),,'00'x)
timeleft=C2D(CHARIN(userfile,111,1)) + (C2D(CHARIN(userfile,112,1)) * 256)
priv=9-C2D(CHARIN(userfile,141,1))
if priv=-1 then priv=0
if priv<-1 then priv=10
do x=212 to 211 by -1
usedbytes=(usedbytes * 256) + C2D(CHARIN(userfile,x,1))
end /* do */
call LINEOUT(userfile)
if usedbytes>32767 then usedbytes=usedbytes-65536
do x=325+(priv*14) to 324+(priv*14) by -1
privbytes=(privbytes * 256) + C2D(CHARIN('max.prm',x,1))
end /* do */
call LINEOUT('max.prm')
bytes=privbytes-usedbytes
num=0
DO UNTIL (name=SUBWORD(acct.num,1,2)) | (LINES(bankfile)=0)
num=num + 1
acct.num=LINEIN(bankfile)
end /* do */
if (LINES(bankfile)=0) & \(name = SUBWORD(acct.num,1,2)) then do
banktime=0
bankbytes=0
ttime=withtime
tbytes=withbytes
okfile=LINEOUT(bankfile,name DATE(S) banktime bankbytes withtime withbytes)
call LINEOUT(bankfile)
end /* if */
else do
call LINEOUT(bankfile)
banktime=WORD(acct.num,4)
bankbytes=WORD(acct.num,5)
if DATE(S) = WORD(acct.num,3) then do
ttime=WORD(acct.num,6)
if ttime='' then ttime
tbytes=WORD(acct.num,7)
deptime=deptime+withtime-ttime
withtime=ttime
depbytes=depbytes+withbytes-tbytes
withbytes=tbytes
end /* if */
else do
day=WORD(acct.num,3)
today=DATE(S)
days=((LEFT(today,4)-LEFT(day,4))*360)+((SUBSTR(today,5,2)-SUBSTR(day,5,2))*30)+RIGHT(today,2)-RIGHT(day,2)
inttime=((days*banktime*timeint)%3000)
intbytes=((days*bankbytes*byteint)%3000)
banktime=banktime+inttime
bankbytes=bankbytes+intbytes
say
say
say '
You have earned
' inttime '
since last time on for a balance of
' banktime
say '
You have earned
' intbytes '
since last time on for a balance of
' bankbytes
say
say '
Press any key for menu'
pull
end /* else */
end /* else */
CLS
say
say "
Welcome
" name "
to
" sysop "
Time Bank for Maximus OS/2"
say
say "
D
eposit time"
say "
W
ithdraw time"
say "
P
ut some Kbytes in"
say "
G
et some Kbytes out"
say "
S
peedy deposit all"
say "
Q
uit back to "bbs
say
DO UNTIL choice='Q'
say '1H'
say ''
say ''
say ''
say ''
say ''
say '1H
'
say '
You have
' banktime '
minutes on account and
' timeleft '
minutes left on BBS '
say '
You have
' bankbytes '
Kbytes on account and
' bytes '
Kbytes left on BBS '
say
say '
What would you like to do?
'
pull choice
select
when choice='D' then do
say '
You have
' banktime '
minutes on account and
' timeleft '
minutes left.'
say '
Maximum on account is
' maxtime '
and maximum deposit is
' deptime
say '
How much would you like to deposit?'
pull amount
if datatype(amount,'W') then do
if amount>timeleft then amount=timeleft
if amount>deptime then amount=deptime
if (amount+banktime>maxtime) then amount=maxtime-banktime
timeleft=timeleft-amount
banktime=banktime+amount
deptime=deptime-amount
withtime=withtime+amount
if timeleft=0 then choice='Q'
end
end
when choice='W' then do
say '
You have
' banktime '
minutes on account and
' timeleft '
minutes left.'
say '
Maximum withdrawal is
' withtime
say '
How much would you like to withdraw?'
pull amount
if datatype(amount,'W') then do
if amount>banktime then amount=banktime
if amount>withtime then amount=withtime
deptime=deptime+amount
withtime=withtime-amount
timeleft=timeleft+amount
banktime=banktime-amount
end
end
when choice='P' then do
say '
You have
' bankbytes '
Kbytes on account and
' bytes '
Kbytes left.'
say '
Maximum on account is
' maxbytes '
and maximum deposit is
' depbytes
say '
How much would you like to deposit?'
pull amount
if datatype(amount,'W') then do
if amount>bytes then amount=bytes
if amount>depbytes then amount=depbytes
if (amount+bankbytes>maxbytes) then amount=maxbytes-bankbytes
depbytes=depbytes-amount
withbytes=withbytes+amount
bytes=bytes-amount
bankbytes=bankbytes+amount
end
end
when choice='G' then do
say '
You have
' bankbytes '
Kbytes on account and
' bytes '
Kbytes left.'
say '
Maximum withdrawal is
' withbytes
say '
How much would you like to withdraw?'
pull amount
if datatype(amount,'W') then do
if amount>bankbytes then amount=bankbytes
if amount>withbytes then amount=withbytes
depbytes=depbytes+amount
withbytes=withbytes-amount
bytes=bytes+amount
bankbytes=bankbytes-amount
end
end
when choice='S' then do
say 'Making maximum time deposit and byte deposit'
if timeleft>deptime then amount=deptime
else amount=timeleft
if (amount+banktime>maxtime) then amount=maxtime-banktime
say 'Deposited' amount 'minutes'
timeleft=timeleft-amount
banktime=banktime+amount
deptime=deptime-amount
withtime=withtime+amount
if bytes>depbytes then amount=depbytes
else amount=bytes
if (amount+bankbytes>maxbytes) then amount=maxbytes-bankbytes
say 'Deposited' amount 'Kbytes'
depbytes=depbytes-amount
withbytes=withbytes+amount
bytes=bytes-amount
bankbytes=bankbytes+amount
choice='Q'
end
otherwise NOP
end /* select */
end
say
say
say '
Returning you to
'bbs'
'
timeout = d2c(timeleft//256)
okfile = CHAROUT(userfile,timeout,111)
timeout = d2c(timeleft%256)
okfile = CHAROUT(userfile,timeout,112)
usedbytes=privbytes-bytes
bytesout=d2c(0)
if usedbytes<0 then do
bytesout=d2c(255)
usedbytes=65536+usedbytes
end
okfile=CHAROUT(userfile,bytesout,214)
okfile=CHAROUT(userfile,bytesout,213)
do x=211 to 212 by 1
bytesout= d2c(usedbytes//256)
usedbytes= usedbytes%256
okfile = CHAROUT(userfile,bytesout,x)
end /* do */
'ren' bankfile 'timebank.tmp'
DO UNTIL (LINES('timebank.tmp')=0)
account=LINEIN('timebank.tmp')
if (name=SUBWORD(account,1,2)) then
okfile=LINEOUT(bankfile,name DATE(S) banktime bankbytes withtime withbytes)
else okfile=LINEOUT(bankfile, account)
end /* do */
call LINEOUT(bankfile)
call LINEOUT('timebank.tmp')
'del timebank.tmp'
CLS
return